import React, { Component } from 'react'
import { StyleSheet, View, Text, Image, TouchableOpacity } from 'react-native'

import { connect } from 'react-redux'
import HeaderDefault from '../../components/header/HeaderDefault'

class EveHome extends Component {
  constructor(props) {
    super(props)
    this.state = {}
  }
  static navigationOptions = ({ navigation }) => ({
    header: (
      <HeaderDefault backBtnOnPress={navigation.goBack} title="护理评估" />
    )
  })

  _ItemSection({ tietle }) {
    let iconPath
    switch (tietle) {
      case '一般情况':
        iconPath = require('./src/changgui.png')
        break

      case 'MNA量':
        iconPath = require('./src/xuyang.png')
        break

      case '计时测试':
        iconPath = require('./src/shuye.png')
        break

      default:
        iconPath = require('./src/changgui.png')
        break
    }

    return (
      <TouchableOpacity
        onPress={() => {
          this.props.navigation.navigate('EveTumbleList', {
            tittle: tietle
          })
        }}
      >
        <View
          style={{
            width: screenWidth,
            backgroundColor: 'white',
            height: 80,
            borderBottomColor: '#efefef',
            borderBottomWidth: 1,
            paddingLeft: 15,
            flexDirection: 'row',
            alignItems: 'center'
          }}
        >
          <Image
            style={{ width: 60, height: 60 }}
            resizeMode="stretch"
            source={iconPath}
          />
          <Text>{tietle}</Text>
          <View style={{ flex: 1 }} />
          <Image
            resizeMode="contain"
            style={{ width: 40, height: 30 }}
            source={require('./src/iconfontjiantou5.png')}
          />
        </View>
      </TouchableOpacity>
    )
  }

  render() {
    return (
      <View style={styles.container}>
        {this._ItemSection({ tietle: '一般情况' })}
        {this._ItemSection({ tietle: '跌倒、坠床评估' })}
        {this._ItemSection({ tietle: 'MNA量' })}
        {this._ItemSection({ tietle: '计时测试' })}
      </View>
    )
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: 'white'
  }
})

function select(store) {
  return {}
}

export default connect(select)(EveHome)
